package com.example.r2022913.controller.WxController;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.r2022913.common.ApiRestResponse;
import com.example.r2022913.service.WxService.SwiperService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.net.URISyntaxException;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("wx/swiper")
@Api(tags = "wx小程序服务  swiperController")
@Slf4j
public class SwiperController {

    @Autowired
    SwiperService swiperService;

    @ApiOperation(value = "查询轮播图列表")
    @GetMapping("/page")
    public ApiRestResponse swiperList(@RequestParam(defaultValue = "1") Integer pageNum,
                                      @RequestParam(defaultValue = "10") Integer pageSize,
                                      @RequestParam(defaultValue = "") Map<String, Object> params,
                                      HttpServletRequest httpServletRequest) throws URISyntaxException {
        IPage page = swiperService.swiperList(pageNum,pageSize,params,httpServletRequest);
        return ApiRestResponse.success(page);
    }

}
